package com.itheima.define;

import java.util.Scanner;

public class ArrayDemo6 {
    public static void main(String[] args) {
        //完成评委打分的案例，先静态初始化一个数字，用循环提醒用户输入评委打分，然后求总分和平均分
        double[] scores = new double[5];
        Scanner scanner = new Scanner(System.in);

        for (int i = 0; i < scores.length; i++) {
            System.out.println("请输入第" + (i + 1) + "位评委的打分");
            double score = scanner.nextDouble();
            scores[i] = score;
        }
        double sum = 0;
        for (int i = 0; i < scores.length; i++) {
            sum += scores[i];
        }
        sum = sum / scores.length;
        System.out.println("选手平均分是：" + sum);

    }
}
